home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-23 | 3.4 KB | 159 lines | [TEXT/MPS ] |
- # obsolete.s - Obsolete Runtime Support routines for Metrowerks C++ for PowerPC
- #
- # Copyright © 1993 metrowerks inc. All Rights Reserved.
- #
- #
- # THEORY OF OPERATION
- #
- # This file defines runtime support routines that were required for previous
- # versions of the Metrowerks PowerPC compiler but are now obsolete. They
- # are provided in case existing libraries require them for linking, but
- # they will eventually be removed from the standard PPC Runtime Library.
- #
- # BUILD INSTRUCTIONS
- #
- # To assemble this file:
- #
- # ppcasm obsolete.s -o obsolete.o
- #
- # The object file obsolete.o can be added directly to any CodeWarrior™ project.
- #
-
- dialect powerpc
-
- #
- # Private Data
- #
- csect __constants{RO}
- dc.l 0x43300000 # integer->floating conversion constant
- dc.l 0x80000000
- dc.l 0x43300000 # unsigned->floating conversion constant
- dc.l 0x00000000
-
- #
- # TOC pointers
- #
- toc
- tc __constants{TC}, __constants{RO}
-
-
- # __cvt_int2single - convert 32-bit integer to floating-point single
- #
- # Convert the 32-bit integer in R3 to a floating-point single and return
- # the result in F1.
- #
- csect .__cvt_int2single{PR}
- export .__cvt_int2single{PR}
- lwz r4,__constants{TC}(RTOC)
- xoris r0,r3,0x8000
- lfd fp0,0(r4) # fp0 = integer->floating conversion constant
- stw r0,-4(SP)
- lis r0,0x4330
- stw r0,-8(SP)
- lfd fp1,-8(SP)
- fsubs fp1,fp1,fp0
- blr
-
-
- # __cvt_int2double - convert 32-bit integer to floating-point double
- #
- # Convert the 32-bit integer in R3 to a floating-point double and return
- # the result in F1.
- #
- csect .__cvt_int2double{PR}
- export .__cvt_int2double{PR}
- lwz r4,__constants{TC}(RTOC)
- xoris r0,r3,0x8000
- lfd fp0,0(r4) # fp0 = integer->floating conversion constant
- stw r0,-4(SP)
- lis r0,0x4330
- stw r0,-8(SP)
- lfd fp1,-8(SP)
- fsub fp1,fp1,fp0
- blr
-
-
- # __cvt_uns2single - convert 32-bit unsigned to floating-point single
- #
- # Convert the 32-bit integer in R3 to a floating-point single and return
- # the result in F1.
- #
- csect .__cvt_uns2single{PR}
- export .__cvt_uns2single{PR}
- lwz r4,__constants{TC}(RTOC)
- stw r3,-4(SP)
- lfd fp0,8(r4) # fp0 = unsigned->floating conversion constant
- lis r0,0x4330
- stw r0,-8(SP)
- lfd fp1,-8(SP)
- fsubs fp1,fp1,fp0
- blr
-
-
- # __cvt_uns2double - convert 32-bit unsigned to floating-point double
- #
- # Convert the 32-bit integer in R3 to a floating-point single and return
- # the result in F1.
- #
- csect .__cvt_uns2double{PR}
- export .__cvt_uns2double{PR}
- lwz r4,__constants{TC}(RTOC)
- stw r3,-4(SP)
- lfd fp0,8(r4) # fp0 = unsigned->floating conversion constant
- lis r0,0x4330
- stw r0,-8(SP)
- lfd fp1,-8(SP)
- fsub fp1,fp1,fp0
- blr
-
-
- # __blockmove - move (unaligned) block of data
- #
- # Move the # bytes in R5 from the address in R4 to the address in R3.
- # The # bytes is at least 128. We move the data in 32-byte chunks.
- #
- csect .__blockmove{PR}
- export .__blockmove{PR}
-
- # save some nonvolatile registers that we need
-
- stw r13,-4(SP)
- stw r14,-8(SP)
- stw r15,-12(SP)
-
- # set XER = chunk size
-
- li r7,32
- mtxer r7
-
- # set CTR = #chunks to move
-
- rlwinm r8,r5,27,5,31
- mtctr r8
-
- # set R5 = remainder
-
- rlwinm. r5,r5,0,27,31 # cr0(eq) = no remainder
-
- # copy 32-byte chunks
-
- li r6,0
- loop: lswx r8,r6,r4
- stswx r8,r6,r3
- addi r6,r6,32
- bdnz loop
- beq exit # return if no remainder
-
- # copy remainder
-
- mtxer r5
- lswx r8,r6,r4
- stswx r8,r6,r3
-
- # restore registers and return
-
- exit: lwz r15,-12(SP)
- lwz r14,-8(SP)
- lwz r13,-4(SP)
- blr
-